<!DOCTYPE html>

<?php
require('./PHP/php_users.php');
require('./PHP/php_roles.php');
require('./PHP/php_procedures.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <link rel="shortcut icon" href="Images/oracle-Icon.png"/>   
        <title>Monitor II</title> 
        <meta charset="UTF-8"/>
        <meta name="author" content="GrupoDesarrollador"/>
        <meta name="keywords" content="test"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <!-- Scripts -->
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>  
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<!--        <script src="jquery/jquery-1.11.1.js"></script> 
        <script src="jquery/jquery-ui-1.11.1/jquery-ui.min.js"></script> -->
        <script type="text/javascript" src="https://www.google.com/jsapi"></script> 
        <script type="text/javascript" src="js/bootstrap.js"></script>
        <!--<script type="text/javascript" src="js/bootstrap.min.js"></script>-->
        <script type="text/javascript" src="js/DivRoles.js"></script>
        <script type="text/javascript" src="js/Divusuario.js"></script>
        <script type="text/javascript" src="js/DivPrincipal.js"></script>
        <script type="text/javascript" src="js/Tabbed_Panel.js"></script>
       
        <script type="text/javascript" src="js/Modals_User.js"></script>
        <script type="text/javascript" src="js/Modals_Roles.js"></script>
        <script type="text/javascript" src="js/modals.js"></script>
        
        <script type="text/javascript" src="js/meteYsaca.js"></script>
        <script type="text/javascript" src="js/validaUser.js"></script>
        <script type="text/javascript" src="js/LlenaModificaUsuarios.js"></script>
        <script type="text/javascript" src="js/creaUsuario.js"></script>
        <script type="text/javascript" src="js/validaUser.js"></script>
        <script type="text/javascript" src="js/creaRole.js"></script>
        <script type="text/javascript" src="js/validaRole.js"></script>
        <script type="text/javascript" src="init.js"></script>
        <link rel= "stylesheet" href="CSS/Estilo.css"/>
        <!--CSS<link rel= "stylesheet" href="CSS/Tabbed_Panel.css"/>  -->
        <link rel= "stylesheet" href="CSS/Estilo.css"/>
        <link rel= "stylesheet" href="css/pruebas.css"/>
        <link rel= "stylesheet" href="css/CSSmodals.css"/>
        <!--<link rel= "stylesheet" href="css/bootstrap.min.css"/>-->
        <link rel= "stylesheet" href="css/bootstrap.css"/>
    </head>

    <body>  
        <div id="wrapper" class="container">
            <div class="row">   
                <div  id="header" class="col-md-12" > 
                    <div class="row">

                        <div class="col-md-12">
                            <center><div class="h1">Monitor 2</div></center>
                            <div class="h5">Administraci&oacute;n de permisos, roles, usuarios y controles para un sistema gestor de base de datos Oracle</div>
                        </div>   
                    </div>

                </div>

            </div>

            <div class="row">
                <div id="main" class="row">  
                    <div id="tabbed_section" class="col-md-12">
                        <div id="menu">
                            <ul id="ul_tabs" class="nav nav-tabs" role="tablist">
                                <li class="lh active" role="tab" data-toggle="tab" id="t1" class="encabezado" onClick="change('tab1')">
                                    <a href="#">Principal</a>
                                </li>
                                <li class="lh" id="t2" role="tab" data-toggle="tab" class="encabezado" onClick="change('tab2')">
                                    <a href="#">Usuarios</a>
                                </li>
                                <li class="lh" id="t3" role="tab" data-toggle="tab" class="encabezado" onClick="change('tab3')">
                                    <a href="#">Roles</a>
                                </li>
                            </ul>
                        </div>

                    </div>


                </div>

            </div><!--<div class="row">-->
            <!-- Divs  -->
            <div class="row">
                <div id="Display_content" class="col-md-12" onload="change('h1')">

                    <div id="divPrincipal" class="pestana row">  
                        <div class="col-md-12">
                            <div class="divScroll"> 
                                <?php crea_usuario(); ?>
                            </div>
                        </div>


                    </div>

                    <div id="divUsuarios" class="pestana row">
                        <div class="row row-pestana-usuarios">
                            <div class="col-md-12 divScroll">

                                <?php
                                $cont = 0;
                                $encabezado = Array("*", "Modificar", "Usuario", "Tablespace default", "Tablespace Temporal");
                                $filas = Array();
                                $tbls = procedure_call("TABLA");

                                foreach ($tbls as $t) {

                                    array_push($filas, ++$cont);
                                    array_push($filas, "<button data-toggle='tooltip' data-placement='left' title='Editar' id = '" . $t["USERNAME"] . "' name='" . $t["USERNAME"] . "' class='btn-editar-user btn-xs btn btn-primary'><span class='glyphicon glyphicon-pencil'></span></button>");
                                    array_push($filas, $t["USERNAME"]);
                                    array_push($filas, $t["DEFAULT_TABLESPACE"]);
                                    array_push($filas, $t["TEMPORARY_TABLESPACE"]);
                                }
                                echo Tabla($encabezado, $filas, "", "tablaUser");
                                ?> 
                            </div>

                            <!--POPUP Usuario-->
                            <div class="modal fade " id="modal-modificar-user" tabindex="-1" role="dialog" aria-labelledby="myModalModRol" aria-hidden="true">
                                <div id="popUpUser" class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title" id="myModalLabel">Modificar Usuario: </h4>
                                        </div>
                                        <div id="modal-body-user" class="modal-body">
                                            opciones usuario
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" id="CancelarUser" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                                            <button type="button" id="ModificarUser" class="btn btn-primary">Modificar</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--fin popup-->
                        </div>
                    </div>
                    <div id="divRoles" class="pestana row">
                       
                            <div class="col-md-12">
                                <div class="row">
                                    <button id="btn-AgregarRol" type="button" class="btn btn-info col-md-2">
                                        <span class="glyphicon glyphicon-plus"></span>
                                        Agregar Role
                                    </button>
                                </div>
                                <div class="row">
                                    <div class="col-md-12 divScroll">

                                        <?php
                                        $contador = 0;
                                        $encabezado = Array("*", "Roles del sistema");
                                        $filas = Array();
                                        $tbls = procedure_call("ROLESSISTEMA");
                                        //tablas($tbls);
                                        foreach ($tbls as $t) {

                                            array_push($filas, ++$contador);
                                            array_push($filas, "<button data-toggle='tooltip' data-placement='left' title='Editar' id = '" . $t["ROLE"] . "' name='" . $t["ROLE"] . "' class='btn-editar-role btn-xs btn btn-primary'><span class='glyphicon glyphicon-pencil'></span></button>   " . $t["ROLE"]);
                                        }

                                        $accion = 'alert("Hola")';
                                        echo Tabla($encabezado, $filas, $accion, "TablaRoles");
                                        ?>
                                    </div>

                                </div>
                            </div>
                            <!--POPUP roles-->
                            <div class="modal fade" id="modal-modificar-rol" tabindex="-1" role="dialog" aria-labelledby="myModalModRol" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title" id="myModalLabel">Modificar Role: </h4>
                                        </div>
                                        <div class="modal-body">
                                            <div id ="scroll-tabla-modificar-role" class="col-md-12 divScroll">

                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                                            <button type="button" class="btn btn-primary">Guardar</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--fin popup-->
                       

                        <div class="row row-agregar-role">
                            <div id="crearRol" class="col-md-12">

                                <!--MODAL Agregar Role-->
                                <div class="modal fade" id="modal-agregar-role" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                <h4 class="modal-title" id="myModalLabel">Agregar Role</h4>
                                            </div>
                                            <div class="modal-body">
                                                <?php crea_role() ?>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                                                <button id="btn-guardar-nuevo-role" type="button" class="btn btn-primary" onclick="creaRole()">Guardar Nuevo Role</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div> <!--Display_content-->
            </div>

        </div>
        </div> <!--Display_content-->
        </div>


        </div>
        <footer class="footer">
            <div class="container" style="background-color: #E5E1EA">
                <div class="row">

                    <span class="label label-primary col-md-12">DESARROLADORES: JUAN JOSE SALAZAR , JAVIER BUZANO, SERGIO VILLEGAS</span>

                </div>
            </div>

        </footer>
        
        <div class="modal fade" id="danger" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header modal-header-danger">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h1><i class="glyphicon glyphicon-thumbs-down"></i> No Cachete</h1>
                </div>
                <div class="modal-body">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <!-- Modal -->
 <div class="modal fade" id="success" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header modal-header-success">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h1><i class="glyphicon glyphicon-thumbs-up"></i> Cachete</h1>
                </div>
                <div class="modal-body">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <!-- Modal -->




    </body>
</html>
